package com.sskj.gocoin.mine;


import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;

import com.sskj.common.base.App;
import com.sskj.gocoin.R;
import com.sskj.gocoin.R2;
import com.sskj.gocoin.common.widget.ToolBarLayout;
import com.sskj.gocoin.utils.ClickUtil;
import com.sskj.gocoin.utils.ToastUtil;
import com.sskj.gocoin.v.base.BaseActivity;

import butterknife.BindView;

/**
 * @author Hey
 * Create at  2019/04/02
 */
public class FeedBackActivity extends BaseActivity<FeedBackPresenter> {


    @BindView(R2.id.toolbar)
    ToolBarLayout toolbar;
    @BindView(R2.id.reason)
    EditText reason;
    @BindView(R2.id.submit)
    Button submit;

    @Override
    public FeedBackPresenter getPresenter() {
        return new FeedBackPresenter();
    }

    @Override
    public void initView() {
        toolbar.setLeftButtonOnClickLinster(v -> finish());
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_feed_back_n;
    }

    @Override
    public void initData() {
        ClickUtil.click(submit, () -> {
            if (TextUtils.isEmpty(reason.getText())) {
                ToastUtil.showShort(App.INSTANCE.getString(R.string.fabimineJavaFeedBackActivity1));
                return;
            }
            mPresenter.feedBack(reason.getText().toString());
        });
    }

    public static void start(Context context) {
        Intent intent = new Intent(context, FeedBackActivity.class);
        context.startActivity(intent);
    }

    public void submitSuccess() {
        ToastUtil.showShort(App.INSTANCE.getString(R.string.fabimineJavaFeedBackActivity2));
    }
}
